<form id="<?php echo $uniqid;?>" method="post" style="padding: 8px;">
    <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
        <tr bgcolor="#FFFFFF">
            <td  class="tlabel" width="20%">上级目录：</td>
            <td width="90%">
                <select v-model="params.up" class="forminput inputstyle textbox-text validatebox-text">
                    <option value=0>--根目录--</option>
                    <option disabled>----------</option>
                    <template v-for="(vo,index) in mainMenu">
                        <option :value="vo.id">{{vo.name}}</option>
                        <template v-for="(vo1,idx1) in vo.children">
                            <option :value="vo1.id">&nbsp;&nbsp;&nbsp;|--{{vo1.name}}</option>
                        </template>
                    </template>
                </select>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >名称：</td>
            <td><input type="text"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入姓名.."  v-model="params.name">
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >排序：</td>
            <td><input name="sortorder" type="text"
                       class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                       placeholder="请输入排序.." v-model="params.sortorder"></td>
        </tr>
    </table>
</form>

<script>
    var customeraddVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            params: {},
        },
        methods: {
            submit: function () {
                $.post('/admin/customer/add', customeraddVm.params, function (data) {
                    if (data.ret == 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        $('#<?php echo $uniqid;?>').form('clear');
                        $("#customerdlg").dialog('close');
                        $("#customer").datagrid('reload');
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            }
        }
    });
    $(function () {
        $('#<?php echo $uniqid;?> #customeraddsubmit').click(function (data) {
            customeraddVm.submit();
        });
        qiniu_single('customerPickfiles<?php echo $uniqid;?>', function (res) {
            customeraddVm.$set(customeraddVm.params,"avatar", res);
        });
    });
</script>
